import numpy as np
sin(x)
cos(x)
tan(x)
sinh(x)
conh(x)
tanh(x)
arccos(x)
arctan(x)
arcsin(x)
arccosh(x)
arctanh(x)
arcsinh(x)
arctan2(x,y)
arctan2(x,y)
返回 arctan(x/y)
。
dot(x,y)
inner(x,y)
cross(x,y)
vdot(x,y)
outer(x,y)
kron(x,y)
tensordot(x,y[,axis])
exp(x)
log(x)
log10(x)
sqrt(x)
absolute(x)
conjugate(x)
negative(x)
ceil(x)
floor(x)
fabs(x)
hypot(x)
fmod(x)
maximum(x,y)
minimum(x,y)
hypot
返回对应点 (x,y)
到原点的距离。
x = np.array([1,2,3])
y = np.array([4,5,6])
np.hypot(x,y)
iscomplexobj
iscomplex
isrealobj
isreal
imag
real
real_if_close
isscalar
isneginf
isposinf
isinf
isfinite
isnan
nan_to_num
common_type
typename
正无穷:
np.inf
负无穷:
-np.inf
非法值(Not a number):
np.nan
检查是否为无穷:
np.isinf(1.0)
np.isinf(np.inf)
np.isinf(-np.inf)
非法值:
np.array([0]) / 0.0
这并不会报错,而是返回一个非法值。
只有 0/0
会得到 nan
,非0值除以0会得到无穷:
a = np.arange(5.0)
b = a / 0.0
b
nan
与任何数进行比较都是 False
:
b == np.nan
想要找出 nan
值需要使用 isnan
:
np.isnan(b)
atleast_1d
atleast_2d
atleast_3d
expand_dims
apply_over_axes
apply_along_axis
hstack
vstack
dstack
column_stack
hsplit
vsplit
dsplit
split
squeeze
fix
mod
amax
amin
ptp
sum
cumsum
prod
cumprod
diff
angle
unwrap
sort_complex
trim_zeros
fliplr
flipud
rot90
diag
eye
select
extract
insert
roots
poly
any
all
disp
unique
nansum
nanmax
nanargmax
nanargmin
nanmin
nan
开头的函数会进行相应的操作,但是忽略 nan
值。